<% layout('/layout/default.html', {title: '已办任务', libs: ['dataGrid', 'icheck']}){ %>
<div class="main-content">
		<div class="card-header">
				<i class="fa fa-cubes"></i> 已办任务
			<div class="header-tools float-right">
				<a href="#" class="btn btn-sm btn-secondary" id="btnSearch" title="查询" ><i class="fa fa-filter"></i> 查询</a>
			</div>
		</div>
		<div class="container-fluid">
			<form id="searchForm" action="${ctx}/act/task/historicData" method="post" class="form-inline d-none" >
				<div class="form-group">
					<label class="control-label">任务类型：</label>
					<div class="control-inline">
						<#form:select path="procDefKey" name="label" data="getDictList:act_type" class="form-control ">
						</#form:select>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">完成时间：</label>
					<div class="control-inline">
						<input id="beginDate" name="beginDate" maxlength="64" readonly="readonly" class="form-control required "
								value="" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});" /> -
						<input id="endDate" name="endDate" maxlength="64" readonly="readonly" class="form-control required "
								value="" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});" />
					</div>
				</div>
			
				<div class="form-group">
					<button type="submit" class="btn btn-primary ">查询</button>
					<button type="reset" class="btn btn-secondary ">重置</button>
				</div>
			</form>			
			<table id="btGrid"></table>
	</div>
</div>
<% } %>
<script>
    $.fn.select2.defaults.set('width', '200px');
//初始化DataGrid对象
$('#btGrid').BTGrid({
	searchForm: $("#searchForm"),
	columnModel: [
		{title:'流程名称', field:'procDefname', width:100, align:"center"},
		{title:'当前环节', field:'taskName', width:90, align:"center",formatter: function(val, row, index){
			return row.processIsFinished=="finished"?'<a href="${ctx}/act/task/diagramViewer?definitionId='+row.procDefId+ '&hisInsId=' + row.procInsId + '" class="btnList" title="流程图查看" data-type="diagram">' +val+ '</a>':'<a href="${ctx}/act/task/diagramViewer?definitionId='+row.procDefId+ '&instanceId=' + row.procInsId + '" class="btnList" title="流程图查看" data-type="diagram">' +val+ '</a>';
		}},
		{title:'流程版本', field:'procDefversion', width:80, align:"center",formatter:function(val, row, index){
			return 'V:'+val;
		} },
		{title:'完成时间', field:'hisTaskEndTime', width:100, align:"center" },
		{title:'操作', field:'actions', width:100, align:"center",formatter: function(val, row, index){
			var actions = [];
			<% if(hasPermi('act:process:edit')){ %>
				actions.push('<a href="/act/task/form?taskId='+row.taskId+'&taskName='+row.taskName+'&taskDefKey='+row.taskDefKey+'&procInsId='+row.procInsId+'&procDefId='+row.procDefId+'&status='+row.status+' " class="btn btn-sm btn-success btnList" title="详情查看" >查看详情</a>')
			<% } %>
			return actions.join('');
		}}
	],
	// 加载成功后执行事件
	ajaxSuccess: function(data){
		
	}
});
</script>